p <- seq(0, 1, 0.01)
q <- 1 - p
pq <- p * q
plot(p, pq, type="l", lwd=2)
abline(v=0.5, lty=2)

k <- c(0:10)
n <- 10
par(mfrow=c(3, 1))
# p=0.1
p <- 0.1
pr <- dbinom(k, n, p)
plot(k, pr)
# p=0.5
p <- 0.5
pr <- dbinom(k, n, p)
plot(k, pr)
# p=0.9
p <- 0.9
pr <- dbinom(k, n, p)
plot(k, pr, type="h", lwd=7)
